package 笔试.笔试360;

import java.util.Arrays;
import java.util.Scanner;

/**
 * @author:谢君臣
 * @Date:2021/8/29-15:40
 * @version:1.0
 * @function:
 */
public class Main02 {
    public static int min = 0;
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n= scanner.nextInt();
        int m= scanner.nextInt();
        int x= scanner.nextInt();
        int k= scanner.nextInt();
        int [] arr = new int[n];
        for (int i = 0; i < n; i++) {
            arr[i] = scanner.nextInt();
        }
        getMin(arr,m,x,k);
        System.out.println(min);
    }

    private static void getMin(int[] arr, int m, int x, int k) {
        if (m<=0){
            min = Math.max(min,findMin(arr));
            System.out.println(arr);
        }
        else{
            for (int i = 0; i < arr.length; i++) {
                int[] temp = Arrays.copyOfRange(arr,0,arr.length);
                temp[i] +=k;
                for (int j = 1; j <= x ; j++) {
                    if (i-j>=0) temp[i-j] += k;
                    if (i+j<arr.length) temp[i+j] += k;
                }
                getMin(temp,m-1,x,k);
            }
        }
    }
    private static int findMin(int[] arr) {
        int temp = arr[0];
        for (int i : arr) {
            temp = Math.min(temp,i);
        }
        return temp;
    }
}
